package jk.wrapper.handle;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;

import jk.wrapper.Resource;
import jk.wrapper.ResultMap;

public class ObjectCallTagHandle extends AbstractTagHandle {
	protected String method;
	
	public void handle(ResultMap retMap) {
		try {
			Resource res = retMap.getResource();
			Method getMethod = retMap.getResource().getClass().getMethod(method);
			String ret = getMethod.invoke(res).toString();
			List<String> retList = null;
			retList = super.filter(ret);
			retMap.getCurResultBean().setValues(retList);
		} catch (SecurityException e) {
		} catch (NoSuchMethodException e) {
		} catch (IllegalArgumentException e) {
		} catch (IllegalAccessException e) {
		} catch (InvocationTargetException e) {
		}
	}
	
	public void setCallMethod(String method) {
		this.method = method;
	}
}
